//
//  LFGroupTableViewCell.m
//  QingDaoCommunity
//
//  Created by 李学林 on 15/11/25.
//  Copyright © 2015年 teteTechnology. All rights reserved.
//

#import "LFGroupTableViewCell.h"
#import "LFGroupCollectionViewCell.h"

@interface LFGroupTableViewCell ()<UICollectionViewDataSource,UICollectionViewDelegate>

@property (weak, nonatomic) IBOutlet UICollectionView *collectionView;

@end


@implementation LFGroupTableViewCell

- (void)awakeFromNib {

    //  注册cell
    [self.collectionView registerNib:[UINib nibWithNibName:@"LFGroupCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"UICollectionViewCell"];
    
    self.collectionView.delegate = self;
    self.collectionView.dataSource = self;
    
//    self.collectionView.layer.borderWidth = 0.5;
//    self.collectionView.layer.borderColor = [UIColor lightGrayColor].CGColor;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}



- (void)setHomeModel:(LFHomeModel *)homeModel
{
    _homeModel = homeModel;

    [self.collectionView reloadData];
}



#pragma mark----UICollectionViewDataSource
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    
    
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{

    return self.homeModel.group.list.count;
}


- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    static NSString *UICollectionViewCellID = @"UICollectionViewCell";
    
    LFGroupCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:UICollectionViewCellID forIndexPath:indexPath];

    cell.model = self.homeModel.group.list[indexPath.item];
    
    return cell;

}



@end
